package demo1.src.chapter04.d_4_3;
class Radio{
    public void play(){
        System.out.println("收音机播放");
    }
}
class Walkman{
    public void play(){
        System.out.println("随身听播放");
    }
}
class MobilePhone{
    public void play(){
        System.out.println("手机播放");;
    }
}
interface  Soundable{
    void play(int n);
}
class Sound implements Soundable{
    public void play(int n){
        if (n==1){
            Radio radio = new Radio();
            radio.play();
        }
        if (n==2) {
            Walkman walkman = new Walkman();
            walkman.play();
        }
        if (n ==3){
            MobilePhone mobilePhone = new MobilePhone();
            mobilePhone.play();
        }
    }
}
public class Tsound {
    public static void main(String[] args) {
        Sound sound = new Sound();
        sound.play(1);
        sound.play(2);
        sound.play(3);
    }
}